package com.fh.common.distributedlock.config;

import javax.annotation.Resource;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;

import com.fh.common.distributedlock.DLockType;
import com.fh.common.distributedlock.DefaultDistributeLockBuilder;
import com.fh.common.distributedlock.DistributeLock;

/**
 * 
 * @author junqiu
 *
 */
@Configuration
public class DistributeLockConfig {

	@Resource
	private RedisTemplate<String, Object> redisTemplate;
	
	@Bean
	public DistributeLock createDistributeLock(RedisTemplate<String, Object> redisTemplate) {
		return new DefaultDistributeLockBuilder().build(DLockType.BASE_REDIS_LOCK, redisTemplate);
	}
}
